<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <form>
            User:<input type="text" id="username" name="username"/><br/>
            Password:<input type="password" id="password" name="password"/><br/>
            <input type="button" id="btn-submit" onclick="validar();" value="Enviar"/>
        </form>
    </body>
    <script type="text/javascript" >
        function validar(){
            
            var password = document.getElementById("password").value;
            var username = document.getElementById("username").value;
            

            if(password.trim().length == 0 && username.trim().length == 0){
                alert("Campos vazios");
                return false;
            }
            else if(password == "123" && username == "username"){
                alert("Logado com sucesso");
                return false;
            }
            else{
                alert("Senha inválida");
                return false;
            }
        }
    </script>
</html>
